<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html  xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:p="http://primefaces.prime.com.tr/ui"
       xmlns:c="http://java.sun.com/jsp/jstl/core">

    <body>

        <ui:composition template="./Test.xhtml">



            <ui:define name="content">

                <fieldset style="height: 700px">
                    <legend><b>Add New Admin</b></legend>


                    <center>
                        <table width="716" height="513">
                            <tr>
                                <td><h2><b>Add Admin!</b></h2></td>
                            </tr>

                            <tr>
                                <td height="47"><b>User Name *</b> </td>
                                <td><p:inputText value="#{adminBean.adm.userName}" id="txtuser" required="true" requiredMessage="User Name is not null">
                                        <f:validator validatorId="Validator.CheckValidator"/>
                                        <f:ajax event="change" execute="txtuser" render="" listener="#{adminBean.checkAdminUserName}"/>
                                    </p:inputText>

                                </td>
                                <td> <h:outputText id="display" value="#{adminBean.msg}" style="font-size: smaller;font-weight: normal;color: red"/>
                                    <h:message for="txtuser" style="font-size: small;font-weight: normal;color: red"/></td>
                            </tr>

                            <tr>
                                <td height="45"><b>Password *</b> </td>
                                <td><p:password value="#{adminBean.adm.password}" feedback="true" minLength="6" id="txtpassword" required="true" requiredMessage="Password is not null">
                                        <!--<f:validator validatorId="Validator.CheckValidator"/>-->
                                    </p:password>
                                </td>
                                <td> <h:message for="txtpassword" style="font-size: small;font-weight: normal;color: red"/></td>
                            </tr>

                            <tr>
                                <td height="45"><b>Full Name *</b></td>
                                <td><p:inputText value="#{adminBean.adm.fullName}" id="txtfullName" required="true" requiredMessage="FullName is not null">
                                        <!--<f:validator validatorId="Validator.StringValidator"/>--></p:inputText></td>
                                <td>
                                    <h:message for="txtfullName" style="font-size: small;font-weight: normal;color: red"/></td>
                            </tr>

                            <tr>
                                <td height="45"><b>Phones *</b></td>
                                <td><p:inputText value="#{adminBean.adm.phone}" id="txtphone" required="true" requiredMessage="Phone is not null">
                                        <f:validator validatorId="Validator.PhoneValidator"/>
                                    </p:inputText></td>
                                <td>
                                    <h:message for="txtphone" style="font-size: small;font-weight: normal;color: red"/></td>
                            </tr>

                            <tr>
                                <td height="45"><b>Address *</b></td>
                                <td><p:editor value="#{adminBean.adm.address}" id="txtaddress" required="true" requiredMessage="Address is not null">
                                    </p:editor></td>
                                <td>
                                    <h:message for="txtaddress" style="font-size: small;font-weight: normal;color: red"/></td>
                            </tr>
                            <tr>
                                <td height="61"><b>Email *</b></td>
                                <td><p:inputText value="#{adminBean.adm.email}" id="txtemail" required="true" requiredMessage="Email is not null">
                                        <f:validator validatorId="Validator.EmailValidator"/>
                                        <f:ajax event="change" execute="txtemail" render="emailError" listener="#{adminBean.checkAdminEmail}"/>
                                    </p:inputText>
                                </td>
                                <td><h:outputText id="emailError" value="#{adminBean.msg2}" style="font-size: smaller;font-weight: normal;color: red"/>
                                    <h:message for="txtemail" style="font-size: small;font-weight: normal;color: red"/></td>
                            </tr>

                            <tr>
                                <td height="45"><b>Birthday*</b></td>
                                <td ><p:calendar showButtonPanel="true" value="#{adminBean.adm.birthday}" pattern="dd.MM.yyyy"/>  </td>
                                <td>
                                    <!--<h:inputText id="dob" value="" required="true" requiredMessage="please enter your birthdate" label="birthdate">
                                        <f:convertDateTime dateStyle="short" pattern="MM/dd/yyyy"/>
                                      
                                    </h:inputText>
                                    <h:outputLabel value="(MM/dd/yyyy)" style="font-size:x-small;color: gray;font-style: normal"/>-->
                                </td>
                            </tr>
                            <tr>
                                <td height="65"></td>
                                <td>
                                    <h:commandButton action="AdminHome" actionListener="#{adminBean.insertAdmin}" type="image" image="../resources/images/forms/form_submit.gif"/>

                                    <h:commandButton value="Reset" type="reset" image="../resources/images/forms/form_reset.gif"/>
                                </td>
                                <td></td>
                            </tr>
                        </table>
                    </center>

                </fieldset>

            </ui:define>

        </ui:composition>

    </body>
</html>
